﻿package com.ease.model.type
{
	import com.ease.common.enums.ValuableEnum;
	import com.ease.lang.Enum;
	import com.ease.lang.EnumConstants;
	import com.ease.model.type.DataType;

	[Bindable]
	[RemoteClass(alias="com.ease.model.type.DataType")]

	public class DataType extends Enum
	{
		/* static init */
		{ initEnum(DataType); }

		/* Constants */
		public static const UNKNOWN:DataType = new DataType("UNKNOWN", 1, "其他");
		public static const BOOLEAN:DataType = new DataType("BOOLEAN", 10, "布尔");
		public static const STRING:DataType = new DataType("STRING", 11, "字符");
		public static const IPADDRESS:DataType = new DataType("IPADDRESS", 12, "IP地址");
		public static const SINGLE_DICTIONARY:DataType = new DataType("SINGLE_DICTIONARY", 21, "单选");
		public static const MULTIPLE_DICTIONARY:DataType = new DataType("MULTIPLE_DICTIONARY", 22, "多选");
		public static const ENUMERABLE_MODEL:DataType = new DataType("ENUMERABLE_MODEL", 23, "枚举实体");
		public static const ENUMERABLE_REFERENCE:DataType = new DataType("ENUMERABLE_REFERENCE", 24, "枚举引用");
		public static const BYTE:DataType = new DataType("BYTE", 31, "字节");
		public static const SHORT:DataType = new DataType("SHORT", 32, "短整型");
		public static const INTEGER:DataType = new DataType("INTEGER", 33, "整型");
		public static const LONG:DataType = new DataType("LONG", 34, "长整型");
		public static const FLOAT:DataType = new DataType("FLOAT", 41, "单精浮点");
		public static const DOUBLE:DataType = new DataType("DOUBLE", 42, "双精浮点");
		public static const PRECENTAGE:DataType = new DataType("PRECENTAGE", 43, "百分比");
		public static const DATE:DataType = new DataType("DATE", 51, "日期");
		public static const DATETIME:DataType = new DataType("DATETIME", 52, "日期时间");
		public static const TIME:DataType = new DataType("TIME", 53, "时间");
		public static const BLOB:DataType = new DataType("BLOB", 61, "二进制大对象");
		public static const CLOB:DataType = new DataType("CLOB", 62, "字符大型对象");
		public static const RELATIONSHIP:DataType = new DataType("RELATIONSHIP", 71, "关联关系");
		public static const LOCATIONRELATIONSHIP:DataType = new DataType("LOCATIONRELATIONSHIP", 72, "区域关联关系");

		private var _value:int;
		private var _text:String;

		/*public*/ function DataType(name:String=null ,value:int=0 ,text:String=null) {
			super.name = name;
			this._value = value;
			this._text = text;
		}

		public function get value():int  { return this._value; }
		public function get text():String  { return this._text; }

		/* constant query */
		public static function getEnumConstants():Array {
			return Enum.getEnumConstants(DataType);
		}

		public static function get(constantName:String, caseSensitive:Boolean = false):DataType {
			return DataType(Enum.get(DataType, constantName, caseSensitive));
		}
	}
}